package com.example.springdemo.design_model;

/**
 * @author zhangding
 * @date
 */
public class InterfaceIsolation {

    public static void main(String[] args) {
        AA aa = new AA();
        aa.AAmethod1(new A());
    }

}

abstract interface inteface{
    void method1();
    void method2();
}

 class A implements inteface{

    @Override
    public void method1() {
        System.out.println("A实现1");
    }
    // 这个方法类A本来可以不用实现！！，但是接口必须全部实现
    @Override
    public void method2() {
        System.out.println("A实现2");
    }
}
class AA{
    public void AAmethod1(inteface inteface){
            inteface.method1();
           inteface.method2();
    }
}
class BB{
    public void AAmethod2(inteface inteface){
        inteface.method2();
    }
}


class B implements inteface{

    @Override
    public void method1() {
        System.out.println("B实现1");
    }

    @Override
    public void method2() {
        System.out.println("B实现2");
    }

}

